Introduction to ApeScript - Contents - ApeScript Notes

THE APESCRIPT INTERFACE INTO THE NOBLE APE SIMULATION

Variables automatically defined in ApeScript run in the Noble Ape Simulation.

VariableTypeNotes



randomoutputspecial - produces a 16-bit random number
vector_angleinput/outputvalues from 0 to 255 with wrap-around (for greater values)
vector_x outputbased on vector_angle (-840 to 840)
vector_youtputbased on vector_angle (-840 to 840)

Land
test_xinput/output
test_yinput/output
test_zoutputbased on test_x and test_y, provides numerical land height

timeoutputconstant dt - numerical 24 hour time in minutes (see File Format)
dateoutputconstant dt - numerical date in days (see File Format)
weatheroutputbased on test_x and test_y, weather value and time of day/night - Daytime Sun(0), Daytime Cloudy(1), Daytime Rain(2), Nighttime Sun(3), Nighttime Cloudy(4), Nighttime Rain(5), Sunrise/Sunset(6)
water_leveloutputconstant - the numerical water level (from z height)

Being
number_beingsoutputconstant dt
current_beingoutputconstant db
select_beinginput/outputset to current_being initially

location_xoutputbased on select_being (see File Format)
location_youtputbased on select_being (see File Format)
location_zoutputbased on location_x and location_y (ie select_being), provides numerical land height
id_numberoutputbased on select_being (see File Format)
date_of_birthoutputbased on select_being (see File Format)
stateoutputbased on select_being (see File Format)
listenoutputbased on select_being from speak (see File Format)
facingi/o beingNOT based on select_being (see File Format)
speedi/o beingNOT based on select_being (see File Format)
energyi/o beingNOT based on select_being (see File Format)
honori/o beingNOT based on select_being (see File Format)
parasitesi/o beingNOT based on select_being (see File Format)
heighti/o beingNOT based on select_being (see File Format)
family_name1i/o beingNOT based on select_being (see File Format)
family_name2i/o beingNOT based on select_being (see File Format)
goal_typei/o beingNOT based on select_being (see File Format)
goal_xi/o beingNOT based on select_being (see File Format)
goal_yi/o beingNOT based on select_being (see File Format)
drive_hungeri/o beingNOT based on select_being (see File Format)
drive_sociali/o beingNOT based on select_being (see File Format)
drive_fatiguei/o beingNOT based on select_being (see File Format)
drive_sexi/o beingNOT based on select_being (see File Format)
speaki/o beingNOT based on select_being, to be spoken next dt (see File Format)
hungryoutputconstant - the numerical hunger level (from energy)

is_visibleoutputbased on location_x, location_y, facing, test_x and test_y - shows if the test point is visible
(NOTE the distinction between location_x/location_y vs facing if select_being != current_being, is_visible will allow this but it won't produce the desired results)

brain_valuei/o beingbased on brain_x, brain_y and brain_z
brain_xinput/output
brain_yinput/output
brain_zinput/output

Biology
biology_operatorinput/output
biology_outputoutputbased on test_x, test_y and biology_operator

biology_areaoutput
biology_heightoutput
biology_wateroutput
biology_moving_sunoutput
biology_total_sunoutput

biology_bushoutput
biology_grassoutput
biology_treeoutput

biology_insectoutput
biology_mouseoutput
biology_parrotoutput
biology_lizardoutput
biology_eagleoutput



Key
constantremains the same
constant dbconstant for one being in this time cycle
constant dtconstant for all beings in this time cycle
input/outputcan be read from and written to
i/o beinglike input/output but set to and from the being
outputcan only be read from, not written to
specialgenerated every time it is called


APESCRIPT ERRORS THAT CAN BE REPORTED IN THE SIMULATION

This list shows some of the errors provided by ApeScript and their potential causes. (This document is due for an update with a full list of all the errors.)

Assign value failed - Something is wrong with the variable set by an equality.

Brain location(s) are negative - When brain_value is called, brain_x, brain_y and/or brain_z are negative.

Brain location(s) are too big - When brain_value is called, brain_x, brain_y and/or brain_z are larger than 31.

Brain value out of range - brain_value is not in the range 0 to 255.

Character not known - A non-ApeScript character is included in the file. # for example is not recognized by ApeScript.

First value failed - Something is wrong with the first value of an equality, if or while operation. It could be the first and only value in this function.

if/while doesn't end with } - All if/while statements requires a closing brace }.

if/while not followed by ( - All if/while statements require a bracket following the if/while (allowing for any amount of whitespace too).

if/while without { - All if/while statements expect what is executed through the bracket enclosed statement being correct to be followed by inclusive braces { }. There is no single line if or while statements without { } in ApeScript.

Input variable without equals - All variables set require an equals following the variable.

Line start incorrect - A line of code begins incorrectly. It could start with a number or an operator when if/while or a variable was expected.

Maximum ... reached - Where ... is script size, numbers, variables or braces. ApeScript supports a finite number. If this is too few for you (i.e. you get this error in your code and you can't reduce the number of ... you are using), please contact tom at nobleape dot com

Not algorithm - The syntax is incorrect for a variable/number-operator-variable/number sequence. The operator is either unrecognized or is not an operator when it should be.

Number expected - A non-numeric character is included in a number string.

Number too big - Number doesn't fit the range 0 to 65535.

Output set as input variable - An output only variable is attempting to be set.

Second value failed - Something is wrong with the second number/variable value of an equality, if or while operation.

Selected being out of range - select_being greater than or equal to number_beings or negative.

Test value(s) negative - the test_x and test_y values need to be positive.

Test value(s) too big - the test_x and test_y values need to be in the bounds of the map (i.e. no greater than 16383.

Too many } - You have closed too many braces. Go back to the code and see if there is an erroneous additional } in the code.

Unknown syntax - The syntax is incorrect for a particular line.

Wrong syntax end - A bracket or colon was expected but not found.


Introduction to ApeScript - Contents - ApeScript Notes